function postController($scope,$state,$http){
    $http({
        url: '/post/getAllPosts',
        method: 'GET',

    }).success(function (response) {

        console.log("response: " + response);
        $scope.postList = response;



    }).error(function (response) {
        alert('error')
    })

    /*$scope.postList = [
        {
            name:"摄影前期-相机的介绍和选择",
            author:"马晟钊",
            date:'2018.4.20'
        },
        {
            name:"摄影前期-认识摄影的历史和当代摄影分类",
            author:"张慧兰",
            date:'2018.4.19'
        }
    ];*/
    $scope.openSinglePost = function(postId){
        console.log("postId:"+postId);
        $state.go('singlePost',{postId : postId, addFlag : true});
    }
    $scope.openAddPost = function(){
        $state.go('addPost');
    }

}



